package com.lagou.rocket.demo.seckill.controller;


import com.lagou.rocket.demo.seckill.model.Result;
import com.lagou.rocket.demo.seckill.service.ISecKillService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *
 * </p>
 *
 * @author KK
 * @since 2021-10-30
 */
@RestController
public class SeckillController {

    private final ISecKillService secKillService;

    public SeckillController(ISecKillService secKillService) {
        this.secKillService = secKillService;
    }


    @RequestMapping("/seckill")
    public Result seckill(
            @RequestParam("userId") Long userId,
            @RequestParam("productCode") String productCode,
            @RequestParam("num") Integer num
                        ) {
        return Result.ok(secKillService.seckill(userId, productCode, num));
    }






}
